require 'rubygems'
gem 'soap4r'
require 'soap/wsdlDriver'
require 'soap/header/simplehandler'
require 'defaultDriver.rb'
require 'authStub.rb'
require 'WSHelpers.rb'

props = {
  :object => 'SentEvent',
  :props => ['SendID','SubscriberKey','EventDate','EventType','TriggeredSendDefinitionObjectID','BatchID']
}

#Set date to pull from
dateFrom = (DateTime.now - 60).strftime("%m/%d/%y")
#Declare the send filter criteria
filter = {
  :filterType => 'Complex',
  :filter => [['TriggeredSendDefinitionObjectID','isNotNull',nil],'AND',['EventDate','greaterThan',dateFrom]]
}

sentEvent = BuildRetrieve.new
resp = sentEvent.creates(props,filter)

resp.results.each do |result|
  puts result.sendID.to_s + " - " + result.subscriberKey + " - " + result.eventDate.to_s + " - " + result.eventType
end